package com.atguigu.spzx.manager.service.impl;

import com.atguigu.spzx.manager.mapper.SysUserRoleMapper;
import com.atguigu.spzx.manager.service.SysUserRoleService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * @author LT
 * @create 2024-03-14-10:40
 */
@Service
public class SysUserRoleServiceImpl implements SysUserRoleService {

    @Resource
    SysUserRoleMapper sysUserRoleMapper;


    @Override
    public void doAssignUserRole(Integer id, List<Long> roleIds) {

        sysUserRoleMapper.deletedUserRole(id);
        if (CollectionUtils.isEmpty(roleIds)){
            return;
        }
        sysUserRoleMapper.doAssignUserRole(id,roleIds);
    }
}
